<template>
  <a-modal title="YAML文件展示" :visible="visible" @cancel="onClose" :footer="null" :width="800" :maskClosable="false">
    <CodeMirrorEditor v-model:value="yamlText" style="height: 500px" />
  </a-modal>
</template>
<script setup lang="ts">
import { getYamlConfig } from '@/api/pipeline';
const visible = ref(false);
const yamlText = ref('');
const onOpen = async (record: any) => {
  visible.value = true;
  yamlText.value = await getYamlConfig(record.pipelineCode);
};

const onClose = () => {
  visible.value = false;
  yamlText.value = '';
};

defineExpose({
  onOpen,
});
</script>
